﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Final
{
    public partial class UpdateForm : Form
    {
        public UpdateForm()
        {
            InitializeComponent();
        }

        private int id;
        private string title;
        private string author;
        private string createdTime;

        public UpdateForm(int id,string title,string author,string createdTime)
        {
            InitializeComponent();
            this.id = id;
            UpTitleText.Text = title;
            UpAuthorText.Text = author;
            this.createdTime = createdTime;
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }


        //文章修改返回按钮
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var sql = string.Format("UPDATE Articles SET Title='{0}',Author='{1}' where Id={2}", UpTitleText.Text, UpAuthorText.Text, this.id);
            DBhelp.UpdateDeleteAdd(sql);
            this.Close();
        }
    }
}
